<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/27
 * Time: 17:11
 */

namespace app\user\admin;

use app\admin\controller\Admin;
use app\common\builder\ZBuilder;
use think\Db;
class Acon extends Admin
{
    public function index(){
        $data = Db::name('admin_user')
            ->field('id,username,nickname,money')
            ->where('id',is_signin())
            ->select();

//        foreach($da as $k=>$v){
//                dump( date('Y',strtotime($v['time'])));exit;
//        }

        return ZBuilder::make('table')
            ->setTableName('admin_user')
            ->hideCheckbox()
            ->addColumns([
                ['username', '管理员'],
                ['nickname', '等级'],
                ['money', '总盈额'],
//                [date('Y-m',time()),'月份盈利']
            ])
            ->setRowList($data)
            ->fetch();

    }

    public function account(){
        $data = Db::name('admin_account')
            ->where('aid',is_signin())
            ->select();

        return ZBuilder::make('table')
            ->setTableName('admin_account')
            ->addOrder('id,allmoney,money')
            ->hideCheckbox()
            ->addColumns([
                ['id', '序号'],
                ['user', '用户'],
                ['order_id', '中奖单号'],
                ['allmoney','中奖金额'],
                ['money','系统提成'],
                ['time','账变时间'],
            ])
            ->addFilter('order_id,user')
            ->setRowList($data)
            ->fetch();
    }
}

